﻿using System;
using System.ComponentModel;
using ClientOverflow.ViewModels.Interfaces;

namespace ClientOverflow.ViewModels.MainMenus
{
    /// <summary>
    /// MenusViewModel is in charge of setting the main screen available menus. The list of menus are bounded
    /// to the view through the MenusCommands property. Every item in the MenusCommands array is an INamedCommand,
    /// which is a command that expose the visual name itself.
    /// The MenusViewModel also expose an abstract link to UI placeholder. It expose single property named Content.
    /// This property allows to created sub view-models to set the view status by setting the content.
    /// </summary>
    public class MenusViewModel : INotifyPropertyChanged, IMenusViewModel
    {
        public event PropertyChangedEventHandler PropertyChanged = (sender, args) => { };

        public MenusViewModel()
        {
            Login = new LoginCommand(this);
            Register = new RegisterCommand(this);
            AskQuestion = new AskQuestionCommand(this);
            ShowQuestionsList = new ShowQuestionsListCommand(this);
            ShowProfile = new ShowProfileCommand(this);
            ShowTags = new ShowTagsCommand(this);
            ShowKnowledgeSummary = new ShowKnowledgeSummaryCommand(this);

            MenusCommands = new[] { Login, Register, AskQuestion, ShowQuestionsList, ShowProfile, ShowTags, ShowKnowledgeSummary };
        }

        

        public INamedCommand[] MenusCommands { get; private set; }

        private object content;

        public object Content
        {
            get { return content; }
            set
            {
                content = value;
                PropertyChanged(this, new PropertyChangedEventArgs("Content"));
            }
        }

        public INamedCommand Login { get; private set; }
        public INamedCommand Register { get; private set; }
        public INamedCommand AskQuestion { get; private set; }
        public INamedCommand ShowQuestionsList { get; private set; }
        public INamedCommand ShowProfile { get; private set; }
        public INamedCommand ShowTags { get; private set; }
        public INamedCommand ShowKnowledgeSummary { get; private set; }
    }
}